<style>
    #parameters-row {
        display: block;
        margin: 0px;
        margin-bottom: 10px;
        padding: 5px;
    }

    #parameters-row .param-group {
        font-size: 12px;
        margin-right: 10px;
    }

    #parameters-row .param-group .param-label {
        line-height: 30px;
        vertical-align: middle;
        display: inline-block;
        margin-bottom: 5px;
        font-weight: bold;
    }

    #report_view_area {
        display: block;
        padding: 10px;
        overflow: auto;
    }
</style>

<div class="row" id="parameters-row">

    <div class="m-b col-lg-12" style="overflow: hidden;">
        <?php
        $orgAccount = $this->Session->read('org_account');

        function renderParamInput($parameter) {
            $input = "";
            $type = $parameter['ReportParameter']['type'];
            $id = $parameter['ReportParameter']['id'];
            $name = $parameter['ReportParameter']['name'];

            switch ($parameter['ReportParameter']['type']) {
                case 'number':
                    $input = "<input class='parameter form-control input-sm input-s-xs $type' type='$type' value='0' data-parameter-name='$name' />";
                    break;

                case 'date':
                case 'string':
                case 'datetime':
                    $input = "<input class='parameter form-control input-sm $type datepicker-input' type='$type' value='' data-parameter-name='$name' style='width: 140px;' />";
                    break;

                case 'list':
                    $input = "<select class='parameter form-control input-sm list' data-parameter-name='$name'>"
                            . "<option value=''>Choose One</option>"
                            . "<option value=''>------------------</option>";

                    foreach ($parameter['ReportParameterListItem'] as $item) {
                        $value = $item['value'];
                        $key = $item['label'];
                        $input .= "<option value='$value'>$key</option>";
                    }

                    $input .= "</select>";
                    break;

                case 'hidden':
                    $value = $parameter['ReportParameter']['value'];
                    $input = "<input class='parameter hidden' type='$type' value='$value' data-parameter-name='$name' />";
                    break;
            }

            return $input;
        }

        foreach ($parameters as $parameter) {
            echo "<div class='m-b-sm' style='overflow: hidden;'>";
            if ($parameter['ReportParameter']['type'] != 'hidden') {
                echo "<label class='text-sm m-r m-t-xs pull-left' style='min-width: 80px;'>" . $parameter['ReportParameter']['label'] . ": </label> ";
            }

            echo "<div class='pull-left'>";
            echo renderParamInput($parameter);
            echo "</div>";
            echo "</div>";
        }

        echo "<input type='hidden' class='parameter' data-parameter-name='report_id' value='$report_id' />";
        echo "<input type='hidden' class='parameter' data-parameter-name='@organisation_id' value='{$orgAccount['Organisation']['id']}' />";
        echo "<input type='hidden' class='parameter' data-parameter-name='@organisation_member_category_id' value='' id='organisation_member_category_id' />";
        ?>
    </div>

    <div class="col-lg-12">
        <input type="hidden" id="report_title_field" value="<?php echo $report['Report']['title']; ?>" />


        <div class="m-b-sm">
            <a href="<?php echo $this->Html->url(array('action' => 'column_settings', $report_id)); ?>" target="_blank" class="btn btn-white btn-xs" id="settings_btn">
                <i class="fa fa-columns"></i> Columns
            </a>
            
            <button class="btn btn-info btn-xs" id="generate_btn">
                <i class="fa fa-play-circle"></i> Generate
            </button>
        </div>

        <div class="m-b-sm">
            
        </div>

        <!--<div class="m-b-sm">     
            <div class="btn-group">
                <button href="<?php echo $this->Html->url(array('action' => 'printout', $report_id)); ?>" disabled="" target="_blank" class="btn btn-white btn-sm" id="print_btn">
                    <i class="fa fa-print"></i> Print
                </button>
            </div>

            <div class="btn-group">
                <button class="btn btn-white btn-sm dropdown-toggle" disabled="" data-toggle="dropdown" id="export_btn">
                    <i class="fa fa-cloud-download"></i> Export
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="#"><i class="fa fa-list"></i> Microsoft Excel</a></li>
                    <li><a href="#"><i class="fa fa-list-alt"></i> Adobe PDF</a></li>
                </ul>
            </div>
        </div>-->
    </div>


</div>